Ext.define('Admin.view.emergencyDispatch.DdsEdPModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.ddsEdPModel',
    data: {
        evenCd: ''
    },
    stores: {
        evenListStore: {
            autoLoad: true,
            proxy: {
                type: "api",
                reader: {
                    type: "json",
                    rootProperty: "list"
                },
                extraParams: { river: config.RIVER },
                url: config.URL + "emergency/ddsEdEvent/list"
            },
        },
    },
    formulas: {
        hapDt: function(get) {
            var evenCd = get('evenCd');
            var evenListStore = get('evenListStore');
            var range = evenListStore.getRange();
            var result;
            for (var i = 0; i < range.length; i++) {
                if (range[i].getData().evenCd == evenCd) {
                    result = range[i].getData().hapDt;
                }
            }
            return result;
        }
    }
});